package enums;

/**
 * 错误代码枚举
 *
 * @author caspar.chen
 * @version 1.0.0, 2016-9-26
 */
public enum ErrorCode {

    SUCCESS(1, "OK"),
    ERROR_SIMPLE(1000, "请求错误"),
    ERROR_RESOURCE_NONEXISTENT(1001, "不存在的资源或请求方法不正确"),
    ERROR_SYSTEM_ARG(1100, "系统级参数异常"),
    ERROR_SYSTEM_TIMESTAMP_ILLEGAL(1101, "时间戳非法,超越了当前系统时间"),
    ERROR_SYSTEM_TIMESTAMP_EXPIRED(1102, "时间戳过期"),
    ERROR_UNAUTH(1110, "没有客户端身份或权限"),
    ERROR_CLIENT_NOTCONNECTED(1111, "客户端连接异常"),
    ERROR_NOURL_SET(1112, "客户未设置项目路径"),
    ERROR_WRITE(1113, "客户端文件写入失败"),
    ERROR_READ(1114, "客户端文件读取失败"),
    ERROR_USERNAME_UNKOWN(1103, "用户名错误"),
    ERROR_USERPASS_NOTEXISTENT(1104, "密码错误"),
    ERROR_USER_LOCKED(1105, "用户锁定"),
    ERROR_USERNAMEORPASS(1106, "用户名或密码错误"),
    ERROR_USER_INCOMPLETE(1107, "用户信息不完善"),
    ERROR_USERTEL_UNKOWN(1108, "用户手机号错误"),
    ERROR_USER_SIGNED(1109, "账户已登录"),
    ERROR_SYSTEM_SIG(1120, "签名错误"),
    ERROR_PARAM_TYPE_MISMATCH(1200, "参数类型不匹配"),
    ERROR_PARAM_REQUIRED_MISSING(1201, "缺少必要参数"),
    ERROR_PARAM_FORMART(1202, "参数或数据格式错误"),
    ERROR_SAME_SUBJECT(1203, "题目重复"),
    ERROR_NO_ID(1204, "主键不能为空"),
    ERROR_NO_NAME(1205, "名称不能为空"),
    ERROR_CREATE_USER(1206, "账户创建失败"),
    ERROR_UPDATE_USER(1207, "账户更新失败"),
    ERROR_CODE_FAIL(1300, "验证码不正确"),
    ERROR_CODE_EXPIRE(1301, "验证码已过期"),
    ERROR_CODE_SENT(1302, "验证码已发送"),
    ERROR_CODE_NOTSENT(1303, "验证码未发送"),
    ERROR_CODE_SYS(1303, "验证码发送失败"),
    ERROR_NAME_DUPLICATE(1400, "名称重复"),
    ERROR_NAME_LOGiNACCOUNT(9999, "账户重复"),
    ERROR_NAME_RANKIDISNULL(8888, "角色不存在"),
    ERROR_NAME_PHONE_NOFORMAT(8888, "手机格式有误"),
    ERROR_TEL_DUPLICATE(1401, "手机号重复"),
    ERROR_TRAIN_DUPLICATE(1402, "训练重复"),
    ERROR_SPECIAL_DUPLICATE(1403, "专题重复,此专题下已有三元项目"),
    ERROR_CASCADE_PROJECT(1404, "课程内有关联的三元项目,请先删除项目,再删除本课程"),
    ERROR_CASCADE_PROJECT2(1405, "课程内没有关联三元项目的已经删除,关联三元项目的课程没有删除."),
    ERROR_CASCADE_BLOCKTYPE(1406, "积木块分类内有关联的积木块"),

    ERROR_ADD(1501, "添加失败"),
    ERROR_EDIT(1502, "修改失败"),
    ERROR_DELETE(1503, "删除失败"),
    ERROR_CASCADE(1504, "数据有关联"),
    ERROR_CASCADE_TRAIN(1505, "训练有关联"),
    ERROR_OPEN_LESSON(1506, "已开课"),
    ERROR_CLOSE_LESSON(1507, "已结课"),
    ERROR_ADD_REPEAT(1508, "复制失败,请重试"),
    ERROR_TEA_PUBLISH(1509, "发布课程失败!"),
    ERROR_NO_CLASSFILE(1510, "类文件不存在!"),

    ERROR_NO_WORKSPACE(1601, "未配置工作空间"),
    ERROR_NO_CLASSNO(1602, "班级编号不正确"),
    ERROR_CASCADECL(1603, "班级关联失败"),
    ERROR_NO_STUDENT(1604, "学生主键不能为空"),
    ERROR_NO_PRO(1605, "项目主键不能为空"),
    ERROR_NO_TEA(1606, "不是教师角色"),
    ERROR_NO_TASK(1607, "主键错误, 任务不存在"),
    ERROR_NO_PID(1608, "专题文件不能为空"),
    ERROR_NO_PROJECT_FILE(1609, "项目文件不能为空"),
    ERROR_NO_PROJECT_NAME(1611, "项目名称不能为空"),
    ERROR_NO_PROFESSIONAL(1610, "缺少专业"),
    ERROR_NO_TEA_ID(1610, "不是教师身份,或者未选择教师"),
    ERROR_NO_STU(1610, "不是学生身份"),
    ERROR_NO_ANSWER(1611, "未寻找到正确答案"),
    ERROR_NO_MSID(1612, "至少传1个步骤主键,不能都是空"),
    ERROR_NO_ANSWER_EMPTY(1613, "答案为空"),
    ERROR_NO_FILE(1614, "文件上传失败,接不到文件,注意文件上传的key是否正确"),
    ERROR_NO_VIEW_TYPE(1615, "视口数据缺少类型"),
    ERROR_NO_CATALOGUE(1616, "缺少帮助中心目录主键"),
    ERROR_NO_TLIDS(1617, "请把key值设置为tlIds, 并且请确认数据为集合形式"),
    ERROR_NO_CATEGORY(1618, "阶元主键不能为空"),
    ERROR_CASCADE_SPECIAL(1619, "专题有关联"),
    ERROR_NO_SPECIAL(1620, "专题不存在"),

    ERROR_SPECIAL_DELETE(1700, "不能删除,因为有关联的三元项目,如果要把关联三元项目也一并删除,请换一个方法"),
    ERROR_COURSE_DELETE(1701, "请先删除各章节,再删除本课程"),
    ERROR_HAVE_ID(1702, "添加时不要设置主键"),
    ERROR_HAVE_EFFECT(1703, "当前目录已经存在视效,不能再添加新的视效"),
    NOT_COMPLETE(2, "功能未完成,请耐心等待"),

    ERROR_UNRAR(1801, "解压失败"),
    ERROR_NO_SRC(1802, "未找到src目录"),
    ERROR_NO_MAIN(1802, "未找到main目录"),
    ERROR_NO_JAVA(1802, "未找到java目录"),
    ERROR_NO_RAR(1803, "文件格式不是rar"),
    ERROR_RUN_JAR(1803, "jar包启动失败"),
    ERROR_DOWNLOAD(1804, "文件下载失败"),
    NODATA(0, "没有数据");
    //自定义code区域为2000到3000

    private Integer code;
    private String message;

    ErrorCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    ErrorCode(Integer code) {
        this.code = code;
        this.message = null;
    }

    public Integer getCode() {
        return this.code;
    }

    public String getMessage() {
        return this.message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

}
